<?php

namespace app\frontend\controller;

use think\Controller;
use think\Db;


class Index extends Controller
{
    public function index()
    {

        $carousels = Db::table('d_carousels')->order('sort','desc')->limit(5)->select();
        $this->assign('carousels', $carousels);

        $casies = Db::table('d_casies')->order('id','desc')->limit(8)->select();
        $this->assign('casies', $casies);

        $news = Db::table('d_news')->order('id','desc')->order('id','desc')->limit(4)->select();
        $this->assign('news', $news);

        echo $this->fetch();
    }

    public function getConfig()
    {
        $config = Db::table('d_config')->select();
        $d = [];
        foreach ($config as $v) {
            $d[$v['key']] = $v['value'];
        }
        return $d;
    }
}
